Week 1 Analysis


Background

Here is a data table showing the available approved housing apartment options at BYU-Idaho for single students. There are 122 entries comprising 57 female and 65 male apartment options.

# Code to get you started. 
# Only the first 100 observations are shown here because the dataset is really too big to show all of it in a markdown file.
datatable(Rent, options=list(lengthMenu = c(3,10,25)), extensions="Responsive")

Here is a simplified data table showing only Men’s Apartments. Note that Pricing and Distance in Miles to Campus is also shown.

# Use this R-chunk to...
# ...filter this data set down to show only your gender's apartment options. Use the R-chunk below to do this. Call your new data set `Rentf` if you are a female or `Rentm` if you are a male. Then show the new data table using the `datatable(...)` function. -->
Rentm <- filter(Rent, Gender == "M")
datatable(Rentm, options=list(lengthMenu = c(3,10,20)), extensions="Responsive")

This graph displays a pricing and distance comparison of my apartment(La Jolla Apartment) to all other Men’s Apartments in Rexburg.

# Use this R-chunk to...
# ...create a graphic that shows how your apartment (or a friend's) compares to all of the options available.

rentmen <- filter(Rent, Gender == "M")
rentmyapt <- rentmen %>%
  mutate(
    Apartments = case_when(
    Apartment != "LA JOLLA - MEN" ~ "OTHER",
    Apartment == "LA JOLLA - MEN" ~ "LA JOLLA"
  ))

plot_ly(rentmyapt) %>% 
  add_markers(x= ~MilesToCampus, 
              y= ~Price, 
              color= ~Apartments, 
              text= ~Apartment,
              colors=c("blue","red")) %>% 
  layout(title="2018 BYU-Idaho \nMens Housing Comparison", 
         xaxis=list(title="Distance from Manwaring Center"),
         yaxis=list(title="One-Semester Contract Prices"), 
         margin = list(t = -2, r = -2, b = .1, l = -.2, unit = "pt"))

The table below shows average Price, Miles to Campus, and Minutes to Campus of Other Apartments in Rexburg in comparison to La Jolla Apartments.

# Use this R-chunk to...
# ...compute and display a meaningful table of numerical summaries supporting your above graphic.
rentmyapt2 <- rentmen %>%
  mutate(
    Apartments = case_when(
    Apartment != "LA JOLLA - MEN" ~ "OTHER**",
    Apartment == "LA JOLLA - MEN" ~ "LA JOLLA"
  ))
simpData <- select (rentmyapt2, -c(Gender,
                                  Address,
                                  Phone,
                                  PrivateRoomPrice,
                                  Capacity,
                                  ParkingStalls,
                                  Deposit,
                                  UtilityDeposit, 
                                  FloorPlans,
                                  Website,
                                  Latitude,
                                  Longitude,
                                  Description))
simpData2 <- filter(simpData, !is.na(Price))
dataSummary <- simpData2 %>% 
  group_by(Apartments) %>% 
  summarise(Price = mean(Price), `Miles to campus` = mean(MilesToCampus), `Walking Min. to campus` = mean(WalkingMinutes))
pander(dataSummary)
Apartments Price Miles to campus Walking Min. to campus
LA JOLLA 1189 0.1864 4
OTHER** 1119 0.3145 6.525

**Averages of all Men’s Apartments in Rexburg.

Conclusion

As shown in the plot graph and comparison table above, the price of La Jolla is lower but comparable to the average price of all Men’s Apartments in Rexburg. However, the Miles to Campus which directly relates to the Minutes to Campus is lower than the average Apartment. La Jolla is a great apartment for those looking for a shorter walk to Campus.